import { getUserRouters } from '../api';
import { formatRouterTree } from '../utils/getMenu';

export default {
  async setUserRouters({ commit, state }) {
    const userRouters = await getUserRouters(state.uid),
      playload = formatRouterTree(userRouters);
    
    commit('setUserRouters', playload);
    commit('setAuth', true);
  }
}